package api

import (
	"blog/app/services"
	"blog/core/request"
	"fmt"
)

type Config struct {
}

func (c Config) Set(req request.InterfaceRequest) {
	data := req.GetContext().PostFormMap("key")
	group := req.PostString("group")

	if len(data) == 0 {
		req.Response().Message("修改值不能为空").Error()
		return
	}

	if group == "" {
		req.Response().Message("组不能为空").Error()
		return
	}

	services.App.Config.SetAll(group, data)
	// core.Cache.
	fmt.Println(data)
}
